<template>
	<view class="body">
		<view class="main" v-for="(item,index) in list">
			<view class="main_left" :style="{backgroundImage:'url('+kjimg+')',backgroundRepeat:'no-repeat'}">
				<view class="top_ft">
					{{item.couponsType == '1' ? '免费一对一咨询券':'免费语音文字咨询券'}}
				</view>
				<view class="bottom_ft">
					有效期至{{item.expirationDate}}
				</view>
			</view>
			<view class="center_border"></view>
			<view class="main_right" :style="{backgroundImage:'url('+kjimg+')',backgroundRepeat:'no-repeat'}">
				<view class="right_btn" @click="submit(item.id)">
					去使用
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		baseURL,
		imgBaseUrl
	} from '@/utils/baseUrl'
	import { myCardAPI } from '../../../utils/myapi.js'
	export default {
		data() {
			return {
				kjimg: imgBaseUrl + '/img/missimg/kajuanbeij.png',
				list:[]
			}
		},
		onLoad(){
			this.getList();
		},
		methods: {
			async getList (){
				const userInfo = uni.getStorageSync('userInfo')
				const res = await myCardAPI(userInfo.id)
				this.list = res?.result?.records
			},
			getimg(image) {
				return imgBaseUrl + image;
			},
			submit(id){
				console.log(id);
			}
		}
	}
</script>

<style lang="less" scoped>
	.body {
		.main {
			padding: 25rpx 25rpx 0rpx 25rpx;
			display: flex;

			.main_left {
				width: 70%;
				height: 75px;
				background: #FFF9F4;
				border-radius: 8px 16px 16px 8px;
				opacity: 1;
				display: flex;
				flex-direction: column;
				// align-items: center;
				justify-content: center;
				letter-spacing: 2rpx;
				line-height: 47rpx;
				.top_ft {
					font-size: 16px;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #333333;
					padding-left: 60rpx;
				}

				.bottom_ft {
					font-size: 24rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #999999;
					padding-left: 60rpx;
				}
			}

			.center_border {
				height: 106rpx;
				border: 1px dashed #DDDDDD;
				margin-top: 11rpx;
			}

			.main_right {
				width: 30%;
				background: #FFF9F4;
				border-radius: 16px 8px 8px 16px;
				opacity: 1;
				display: flex;
				align-items: center;
				justify-content: center;

				.right_btn {
					width: 168rpx;
					height: 64rpx;
					background: #FF7F22;
					text-align: center;
					line-height: 64rpx;
					border-radius: 4rpx 4rpx 4rpx 4rpx;
					opacity: 1;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #FFFFFF;
				}
			}
		}
	}
</style>